﻿using System;
using System.Windows.Markup;

namespace Foundation.MarkupExtensions
{
    public class SelfProvider : IServiceProvider, IProvideValueTarget
    {
        public SelfProvider(object targetObject, object targetProperty)
        {
            TargetObject = targetObject;
            TargetProperty = targetProperty;
        }

        public object TargetObject { get; private set; }
        public object TargetProperty { get; private set; }

        public object GetService(Type serviceType)
        {
            return serviceType == typeof(IProvideValueTarget) ? this : null;
        }
    }
}
